﻿@model CoffeeMobile.Models.ViewModels.TableModel
@{
    ViewBag.Title = "Details";
    Layout = "~/Views/Shared/_LayoutMain.cshtml";
}
@section scripts{
    <script type="text/javascript">
        $('#mylist').listview();
    </script>
}
@section Header{
    @Html.ActionLink("Back", "Index", "Tables", null, new Dictionary<string, object> { { "data-icon", "back" }, { "class", "ui-btn-left" } })
    <h1>@Model.Name</h1>
}
@section Content1st{
    <div data-role="collapsible" data-collapsed="true" class="ui-collapsible ui-collapsible-inset ui-collapsible-collapsed">
        <div class="ui-collapsible-content ui-body-d ui-collapsible-content-collapsed" aria-hidden="true">
            @Html.Partial("_PartialTableListView")
        </div>
    </div>
}
<ul data-role="listview" data-filter="true" data-filter-placeholder="Search fruits...">
    @foreach (FoodGroupModel item in ViewBag.FoodGroupList)
    { 
        <li data-role="list-divider">@item.Name</li>
        foreach (FoodModel subitem in item.FoodModels)
        {
            {
                Html.ViewContext.Writer.Write("<li><a href='#pu" + @subitem.ID + "' data-rel='popup' data-transition='slidedown'>" + @subitem.Name + "</a></li>");
                Html.ViewContext.Writer.Write("<div data-role='popup' class='ui-corner-all' id='pu" + @subitem.ID + "'>");
                Html.ViewContext.Writer.Write("<a href='#' data-rel='back' data-role='button' data-theme='a' data-icon='delete' data-iconpos='notext' class='ui-btn-right'>Close</a>");
                using (Html.BeginForm("Order", "Tables", new { id = subitem.ID, tableid = Model.ID }, FormMethod.Post, new Dictionary<string, object> { }))
                {
                    //Html.ViewContext.Writer.Write("<form name='input' action='/Tables/Order/" + @subitem.ID + "?tableid=" + @Model.ID + "' method='post'>");
                    Html.ViewContext.Writer.Write("<div style='padding:10px 20px;'>");
                    Html.ViewContext.Writer.Write("<h3>Nhập số lượng</h3>");
                    Html.ViewContext.Writer.Write("<label for='number-pattern' class='ui-hidden-accessible'>Số lượng:</label>");
                    Html.ViewContext.Writer.Write("<input type='number' name='number' id='number-pattern' pattern='[0-9]*' value='1' placeholder='Nhập số lượng' data-theme='a'>");
                    Html.ViewContext.Writer.Write("<button type='submit' data-theme='b' data-icon='check'>Order</button>");
                    Html.ViewContext.Writer.Write("</div>");
                    //Html.ViewContext.Writer.Write("</form>");
                }
                Html.ViewContext.Writer.Write("</div>");

            }
        }
    }
</ul>
@section Footer{
    <div data-role="navbar" data-iconpos="top">
        <ul id="mylist">
            <li>@Html.ActionLink("Details", "Details", "Tables", new { id = @Model.ID }, new Dictionary<string, object> { })</li>
            <li>@Html.ActionLink("Order", "Order", "Tables", new { id = @Model.ID }, new Dictionary<string, object> { })</li>
            <li>@Html.ActionLink("Clear", "Clear", "Tables", new { tableid = @Model.ID }, new Dictionary<string, object> { })</li>
        </ul>
    </div>
    <!-- /navbar -->
}
